<style>
    /* post列表样式 */
    *{margin:0;padding:0}
    a:hover{text-decoration:none;}
    .posts{margin-top:10px;list-style:none}
    .posts .post{margin:10px 0px;padding-top:5px;border-top:1px solid #c0c0c0}
    .posts .post .profile-thumbnail{float: left;margin-right:10px}
    .posts .post .post-date{float:right}
    .posts .post .post-author{}
    .posts .post .post-body{}
</style>
<ul class="posts">
    {% for post in posts %}
        <li class="post">
            <div class="profile-thumbnail">
                <a href="{{ url_for('.user',username=post.author.username) }}">
                    <img src="{{ url_for('static',filename='images/heads/' + post.author.head_pic_name) }}" alt="头像" width="50" height="50">
                </a>
            </div>
            <div class="post-date">
                {{ post.timestamp }}
            </div>
            <div class="post-author">
                <a href="{{ url_for('.user',username=post.author.username) }}">
                    {% if post.author.name %}
                        {{ post.author.name }}
                    {% else %}
                        {{ post.author.username }}
                    {% endif %}
                </a>
            </div>
            <div class="post-body">
                {% if post.body_html %}
                    {{ post.body_html | safe }}
                {% else %}
                    {{ post.body }}
                {% endif %}
            </div>
            <div class="post-foot" style="float:right">
                {% if current_user == post.author %}
                    <a href="{{ url_for('.edit_post',id=post.id)}}">
                        <span class="label label-danger">编辑</span>
                    </a>
                {% endif %}
                {% if current_user.is_administrator() %}
                    <a href="{{ url_for('.edit_post',id=post.id)}}">
                        <span class="label label-danger">编辑(管理员)</span>
                    </a>
                {% endif %}
                <a href="{{ url_for('.post', id=post.id) }}">
                    <span class="label label-default">固定链接</span>
                </a>
            </div>
            <div style="clear:both"></div>
        </li>
    {% endfor %}
</ul>